package anthology.daily_question._25_01;

import java.util.Arrays;

//https://leetcode.cn/problems/maximum-consecutive-floors-without-special-floors/description/?envType=daily-question&envId=2025-01-06
public class _2274不含特殊楼层的最大连续楼层数 {
    class Solution {
        public int maxConsecutive(int bottom, int top, int[] special) {
            Arrays.sort(special);
            int ans = 0;
            ans = Math.max(ans, special[0] - bottom);
            for (int i = 1; i < special.length; ++i) {
                ans = Math.max(ans, special[i] - special[i - 1] - 1);
            }
            ans = Math.max(ans, top - special[special.length - 1]);
            return ans;
        }
    }
}
